package cc.cix.hq.common.validate.code;

import cc.cix.hq.common.upload.service.IRedisService;
import cc.cix.hq.common.validate.code.properties.ValidateCodeProperties;
import cc.cix.hq.common.validate.code.service.IValidateCodeService;
import cc.cix.hq.common.validate.code.service.impl.ValidateCodeServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

/**
 * 验证码
 *
 * @author cix
 */
@EnableConfigurationProperties(ValidateCodeProperties.class)
@RequiredArgsConstructor
public class ValidateCodeAutoConfiguration {

    private final IRedisService redisService;

    @Bean
    public IValidateCodeService validateCodeService(ValidateCodeProperties validateCodeProperties) {
        return new ValidateCodeServiceImpl(validateCodeProperties, redisService);
    }

}
